<include file=".:Common:header" />
<script language="javascript">
function editUser(){
	var row = $('#datagrid').datagrid('getSelected');
	if(!row.id) return;
	window.location.href = "{:U('User/edit')}&id="+row.id;
}
function deleteUser(){
	var row = $('#datagrid').datagrid('getSelected');
	if (row){
		$.messager.confirm('提示', '确定删除该用户吗？', function(r){
			if (r){
				ajaxPost("{:U('User/remove')}", {'id': row.id}, function(d){
					if(d.status == 0){
						alertText(d.info, 'error');
					}else{
						$('#datagrid').datagrid('reload');
					}
				});
			}else return false;
		});	
	}
}
$(function(){
	$('#datagrid').datagrid();
});
</script>
<div id="wrapper" class="wrapper clear">
	<div class="main">
    	<div class="toolbar">
			<a href="{:U('User/add')}" id="addnewitem">新增用户</a>
            <a href="javascript:editUser();" id="edit">修改</a>
			<a href="javascript:deleteUser()" id="remove">删除用户</a>
		</div>
        <div class="table_wrap" style="margin-top:10px;">
        	<div class="table_list">	
                <table id="datagrid" width="100%" title="用户列表" url="{:U('system/User/lst')}" pagination="true" striped="true"  singleSelect="true"  idField="id">
                    <thead>
                        <tr>
                            <th field="id" width="50" sortable="true" checkbox="true">ID</th>
                            <th field="username" width="100" sortable="true">用户名称</th>
                            <th field="status" width="100" sortable="true" align="left">用户状态</th>
                            <th field="custom_name" width="100" align="left">用户组</th>
                            <th field="add_time" width="120" sortable="true" align="left">添加时间</th>
                            <th field="last_login_time" width="120" sortable="true" align="left">最后登录时间</th>
                            <th field="sort" width="50" sortable="true">排序</th>
                            <th field="remark" width="334">备注</th>
                        </tr>
                    </thead>
                </table>
			</div>
		</div>		
	</div>
</div>	
<include file=".:Common:footer" />